
#include <algorithm>
#include "Graph.h"
#include <iostream>

using namespace std;

void Test_Dijkstra()
{
    int TotalPoint, TotalEdge, Start;
    cout << __func__ <<"Entry DynamicDirectGraph's funcs" << endl;
    cin >> TotalPoint >> TotalEdge >> Start;
    DynamicDirectGraph Test(TotalPoint);
    cout << "接下来请插入图" << endl;
    for (int i = 0; i < TotalPoint; i++)
    {
        int _Start, End, Value;
        cout << " 插入序列" << i << endl;
        cin >> _Start >> End >> Value;
        if (auto ret = Test.Insert(_Start, End, Value);
                ret != ECOperateResult::Success)
        {
            cout << "Error Occured!" << endl;
            return ;
        }
    }
    Test.Dijkstra(Start);
    cout<<endl;
    Test.DFS(Start);
}

void Test_Prim()
{
    int TotalPoint, TotalEdge;
    cout<< __func__ << "输入DynamicDirectGraph的构造参数" << endl;
    cin >> TotalPoint >> TotalEdge;
    DynamicUnDirectGraph Test(TotalPoint);
    cout << "接下来请插入图" << endl;
    for (int i = 0; i < TotalEdge; i++)
    {
        int _Start, End, Value;
        cout << " 插入序列" << i << endl;
        cin >> _Start >> End >> Value;
        if (auto ret = Test.Insert(_Start, End, Value);
                ret != ECOperateResult::Success)
        {
            cout << "Error Occured!";
            return ;
        }
    }
    if (auto ret = Test.Prim();
            ret == ECOperateResult::Success)
    {
        cout << Test.Ans << endl;
    }
    else
    {
        cout << "orz" << endl;
    }
}

int main()
{
   // Test_Prim();
    Test_Dijkstra();
}